exports.searchAggregationServer = function (req, res) {

    //最终结果
    var resultData = {}

    //任务流创建
    async.waterfall([

        (cb) => {

            //获取聚合层服务器列表
            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.sysAggregationServerSearch.Request_Api_Url + "/as_is_show/1/skip/0/limit/1000",
                    method: 'GET'
                },
                function (data) {

                    resultData = data.result;

                    cb();

                }
            )

        },

        //检测各个服务器的连接状态
        (cb) => {

            var tasks = [];

            resultData.data.forEach((item) => {

                tasks.push((callback) => {

                    var HTTP_URL = "http://" + item.as_ip + ":" + item.as_port + "/aa/cc"
                  
                    var httpOptions = {};

                    //设置请求地址
                    httpOptions.url = HTTP_URL;

                    //设置请求方式
                    httpOptions.method = "GET";

                    //设置返回值类型
	                httpOptions.json = true;

                    //设置header头
                    httpOptions.headers = {
                        "Content-Type": 'application/x-www-form-urlencoded'
                    };

                    //发起HTTP请求
                    request(httpOptions, function (error, response, body) {


                        //判断是否请求成功
                        if(error){

                            item.status = "STOP";

                        }else{

                            item.status = "RUNNING";
                        }

                        callback()

                    });

                })
            })

            async.waterfall(tasks, cb);


        }

    ], () => {

        //返回最终拼接结果
        RES.successResponse(res, resultData);

    });

}